package com.zbest.zpay.paycore.facade;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.zbest.zpay.paycore.dal.model.PaySubInfoDO;
import com.zbest.zpay.service.paycore.model.PaycoreKeyEnum;
import com.zbest.zpay.shared.process.ProcessService;

@Service("payInfoRecoverFacade")
public class PayInfoRecoverFacadeImpl implements PayInfoRecoverFacade {

    private static final Logger logger       = LoggerFactory
                                                 .getLogger(PayInfoRecoverFacadeImpl.class);
    @Resource
    private ProcessService      processService;

    private final static String PROCESS_NAME = "payinfoRecover";

    @Override
    public void recover(PaySubInfoDO paySubInfoDO) {
        logger.info("支付子单完成，开始提交支付单paySubInfoDO=" + paySubInfoDO);
        try {
            Map<String, Object> dataMap = new HashMap<String, Object>();
            dataMap.put(PaycoreKeyEnum.PAY_SUB_INFO_DO.getCode(), paySubInfoDO);
            processService.execute(PROCESS_NAME, dataMap);
        } catch (Exception e) {
            logger.error("支付单推进异常paySubInfoDO=" + paySubInfoDO, e);
        }

    }

}
